
import bpy





class C_ops_调试_单步(bpy.types.Operator):
	bl_idname = 'node.update_debug_single_step'
	bl_label = '单步'
	#bl_options = {'REGISTER', 'UNDO'}
	
	m_节点树ID名称 = bpy.props.StringProperty(name='节点树ID名称', default='')
	m_节点ID名称 = bpy.props.StringProperty(name='节点ID名称', default='')
	
	def execute(self, context):
		node_group = bpy.data.node_groups[self.m_节点树ID名称]
		node = node_group.nodes[self.m_节点ID名称]
		
		if node :
			node.f_update(是否向下传递=True)
		return {'FINISHED'}


class C_ops_调试_跳出(bpy.types.Operator):
	bl_idname = 'node.update_debug_single_step'
	bl_label = '单步'
	#bl_options = {'REGISTER', 'UNDO'}
	
	m_节点树ID名称 = bpy.props.StringProperty(name='节点树ID名称', default='')
	m_节点ID名称 = bpy.props.StringProperty(name='节点ID名称', default='')
	
	def execute(self, context):
		node_group = bpy.data.node_groups[self.m_节点树ID名称]
		node = node_group.nodes[self.m_节点ID名称]
		
		if node :
			node.f_update(是否向下传递=True)
		return {'FINISHED'}


class C_ops_调试_跳出(bpy.types.Operator):
	bl_idname = 'node.update_debug_single_step'
	bl_label = '单步'
	#bl_options = {'REGISTER', 'UNDO'}
	
	m_节点树ID名称 = bpy.props.StringProperty(name='节点树ID名称', default='')
	m_节点ID名称 = bpy.props.StringProperty(name='节点ID名称', default='')
	
	def execute(self, context):
		node_group = bpy.data.node_groups[self.m_节点树ID名称]
		node = node_group.nodes[self.m_节点ID名称]
		
		if node :
			node.f_update(是否向下传递=True)
		return {'FINISHED'}
		

class NODE_PT_active_node_定位更新节点(bpy.types.Panel):
	bl_space_type = 'NODE_EDITOR'
	bl_region_type = 'UI'
	bl_label = "定位更新节点"

	@classmethod
	def poll(cls, context):
		return context.active_node is not None

	def draw(self, context):
		layout = self.layout
		node = context.active_node

		opera = layout.operator("node.update_node_registration_update")
		opera.m_节点树ID名称 = node.id_data.name
		opera.m_节点ID名称 = node.name





classes = (
	C_ops_定位更新节点,
	NODE_PT_active_node_定位更新节点,
)




def register():
	print('NODE_PT_active_node_定位更新节点')
	#for c in classes:
	#	bpy.utils.register_class(c)
		

def unregister():
	for c in classes:
		bpy.utils.unregister_class(c)
	

